<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
        var y, m, d;
        var total = 0;
        var arr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
        y = Number(prompt("请输入年"));
        m= Number(prompt("请输入月"));
        d = Number(prompt("请输入日"));
        for (var i = 0; i < m - 1; i++) {
            total = total + arr[i];
        }
        if ((y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)) && m > 2) {
            total = total + d + 1
            console.log("该日期为一年中的第"+total+"天");
        } else {
            total = total + d
            console.log("该日期为一年中的第"+total+"天" );
        }
</script>
</html>